$package('itsm.system');

itsm.system.userRecharge=function(){
	this.opt='';
	return {
		//列表
		userRechargeGrid:function(){
			var _param = $('#userRechargeForm').getForm();
			var params = $.extend({},jqGridParams, {	
				url:'trans!findTransactionRecordPager.action',
				postData:_param,
				caption:'用户充值记录',
				colNames:['ID','会员ID','对象','类型','收入','支出','余额','操作时间','备注'],
			 	colModel:[
			 	          {name:'recordId',align:'center'},
			 	          {name:'loginName',align:'center'},
			 	          {name:'transactionObject',align:'center'},
			 	          {name:'transactionType',align:'center',formatter:i18nForma},
			 	          {name:'income',align:'center'},
			 	          {name:'expenditure',align:'center'},
			 	          {name:'balance',align:'center'},
			 	          {name:'optDate',align:'center',formatter:timeFormatter},
			 	          {name:'remark',align:'center'}
			 	          
			 	],
				jsonReader: $.extend(jqGridJsonReader, {id: "recordId"}),
				sortname:'recordId',
				pager:'#userRechargePager'
				});
				$("#userRechargeGrid").jqGrid(params);
				$("#userRechargeGrid").navGrid('#userRechargePager',navGridParams);
				//列表操作项
				$("#t_userRechargeGrid").css(jqGridTopStyles);
				$("#t_userRechargeGrid").html($('#userRechargeGridToolbar').html());
				
				//自适应宽度
				setGridWidth("#userRechargeGrid","regCenter",10);
		},
		
		//打开搜索窗口
		openSearchWin:function(){
			$('#userRechargeMain_search_win').window('open');
		},
		//搜索
		searchuserRecharge:function(){
			var sdata=$('#userRechargeAdd form').getForm();
			var _url = 'registerUser!userRecharge.action';
			$.post('',sdata,function(data){
				msgShow('保存成功!','show');
			});
		},
		
		rechargeAdd:function(){
			var _param = $('#userRechargeAdd').serialize();
			$("#rechargeSubmitAdd").attr("disabled", true);
			$.post('registerUser!userOpt.action?optType=ChongZhi',_param,function(data){
				alert(data);
				$("#rechargeSubmitAdd").attr("disabled", false);
				$('#userRechargeGrid').trigger('reloadGrid');
			})
		},
		staticAdd:function(){
			var _param = $('#staticAdd').serialize();
			$("#staticSubmitAdd").attr("disabled", true);
			$.post('registerUser!userOpt.action?optType=ChongZhi',_param,function(data){
				alert(data);
				$("#staticSubmitAdd").attr("disabled", false);
				$('#userRechargeGrid').trigger('reloadGrid');
			})
		},
		rechargeRed:function(){
			var _param = $('#userRechargeRed').serialize();
			$("#rechargeSubmitRed").attr("disabled", true);
			$.post('registerUser!userOpt.action?optType=ChongZhi',_param,function(data){
				alert(data);
				$("#rechargeSubmitRed").attr("disabled", false);
				$('#userRechargeGrid').trigger('reloadGrid');
			})
		},
		dynamicRed:function(){
			var _param = $('#dynamicRed').serialize();
			$("#dynamicSubmitRed").attr("disabled", true);
			$.post('registerUser!userOpt.action?optType=ChongZhi',_param,function(data){
				alert(data);
				$("#dynamicSubmitRed").attr("disabled", false);
				$('#userRechargeGrid').trigger('reloadGrid');
				//itsm.common.utility.tabUtility.addTab('交易记录','system/transMain.jsp')
			})
		},
		staticRed:function(){
			var _param = $('#staticRed').serialize();
			$("#staticSubmitRed").attr("disabled", true);
			$.post('registerUser!userOpt.action?optType=ChongZhi',_param,function(data){
				alert(data);
				$("#staticSubmitRed").attr("disabled", false);
				$('#userRechargeGrid').trigger('reloadGrid');
				//itsm.common.utility.tabUtility.addTab('交易记录','system/transMain.jsp')
			})
		},
		
		init:function(){
			itsm.system.userRecharge.userRechargeGrid();
		}
	}
	
}();

$(function(){
	itsm.system.userRecharge.init();
});